// Power Twitter for Greasemonkey
// version 1.33
// 2007-04-08 first release
// Copyright (c) 2007-9, Narendra Rocherolle, Nick Wilder
//
// ==UserScript==
// @name          egoing style twitter
// @namespace     http://egoing.net
// @description   egoing이 자기가 쓰기 위해서 만든 원숭이 장난감
// @include       http://twitter.com/*
// @include	  https://twitter.com/*
// ==/UserScript==

var win = (typeof jQuery != "undefined") ? window : unsafeWindow;

;(function(jQuery, twttr){
  var $ = win.$;
	
  var status = {};
  var user = $('meta[name=session-user-screen_name]').attr('content');
  var pageuser = $('meta[name=page-user-screen_name]').attr('content');
  var currentpage = $('body').attr('id');
  
	$('head').append('<link type="text/css" rel="stylesheet" media="screen" href="<?php echo $_POST['styleSheet']?>"/>');
	$('.status-btn').append(
		'<input type="submit" tabindex="2" class="status-btn round-btn spellcheckSubmit" id="spellcheckSubmit" value="Spell Ceheck" name="update"/>'+
		'<input type="submit" tabindex="2" class="status-btn round-btn tinyTextSubmit" id="tinyTextSubmit" value="tinyText" name="update"/>'	
	);
	
	$('body').prepend(
		'<form id="spellcheck_form" target="spellCheck" action="http://egoing.net/plugin/spellcheck_twitter" method="POST">'+
		'	<input id="spellcheck_content" type="hidden" name="content"></input>'+
		'</form>'				
	);
	
	$('.spellcheckSubmit').click( function(e){
		$('#spellcheck_content').val($('#status').val());
		$('#spellcheck_form').submit();
		return false;
	});
	
	$('.tinyTextSubmit').click(function(e){
		$('#status').val($('#status').val().replace(/([,.?'()])[ ]/gim, "$1"));
		return false;
	});
	
	//$.get("http://twitter.com/statuses/user_timeline.json?screen_name="+user,{}, function(data){
	/*
	$.get("http://twitter.com/statuses/mentions.json",{}, function(data){
		var innerStr = '';
		var data = (eval(data));
		for(var i=0; i<data.length; i++){
			var d = data[i];
			console.log(d);
			innerStr+='<li>'+d.text+'</li>';
		}
		innerStr = innerStr.replace(/@([a-zA-Z0-9_]+)/gmi,'@<a href="http://twitter.com/$1">$1</a>');
		innerStr = '<ol class="side_mention">'+innerStr.replace(/(^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-z][a-z0-9_]*)?$)/gmi,'<a href="$1">$1</a>')+'</ol>';
		$('#side').append(innerStr);
	});
*/

})(win.jQuery, win.twttr)